/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojos;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author A7med Kotb
 */
@Entity
@Table(name = "source_code")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SourceCode.findAll", query = "SELECT s FROM SourceCode s"),
    @NamedQuery(name = "SourceCode.findByScId", query = "SELECT s FROM SourceCode s WHERE s.scId = :scId"),
    @NamedQuery(name = "SourceCode.findByHourlyRate", query = "SELECT s FROM SourceCode s WHERE s.hourlyRate = :hourlyRate"),
    @NamedQuery(name = "SourceCode.findByStartDate", query = "SELECT s FROM SourceCode s WHERE s.startDate = :startDate"),
    @NamedQuery(name = "SourceCode.findByExpireDate", query = "SELECT s FROM SourceCode s WHERE s.expireDate = :expireDate")})
public class SourceCode implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "sc_id")
    private Integer scId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hourly_rate")
    private long hourlyRate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "start_date")
    @Temporal(TemporalType.DATE)
    private Date startDate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "expire_date")
    @Temporal(TemporalType.DATE)
    private Date expireDate;
    @Column(name = "activity_code")
    private String activityCode;
    @JoinColumn(name = "subcont_res_name", referencedColumnName = "sub_res_id")
    @ManyToOne(optional = false)
    private SubcontarctorResources subcontResName;
    @JoinColumn(name = "role", referencedColumnName = "job_title_id")
    @ManyToOne(optional = false)
    private JobsTitles role;
    @JoinColumn(name = "project_code", referencedColumnName = "pro_id")
    @ManyToOne(optional = false)
    private Projects projectCode;
    @JoinColumn(name = "employee", referencedColumnName = "emp_id")
    @ManyToOne(optional = false)
    private Employees employee;
    @JoinColumn(name = "currency", referencedColumnName = "curr_id")
    @ManyToOne(optional = false)
    private Currencies currency;

    public SourceCode() {
    }

    public SourceCode(Integer scId) {
        this.scId = scId;
    }

    public SourceCode(Integer scId, long hourlyRate, Date startDate, Date expireDate) {
        this.scId = scId;
        this.hourlyRate = hourlyRate;
        this.startDate = startDate;
        this.expireDate = expireDate;
    }

    public Integer getScId() {
        return scId;
    }

    public String getActivityCode() {
        return activityCode;
    }

    public void setActivityCode(String activityCode) {
        this.activityCode = activityCode;
    }
    
    public void setScId(Integer scId) {
        this.scId = scId;
    }

    public long getHourlyRate() {
        return hourlyRate;
    }

    public void setHourlyRate(long hourlyRate) {
        this.hourlyRate = hourlyRate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getExpireDate() {
        return expireDate;
    }

    public void setExpireDate(Date expireDate) {
        this.expireDate = expireDate;
    }

    public SubcontarctorResources getSubcontResName() {
        return subcontResName;
    }

    public void setSubcontResName(SubcontarctorResources subcontResName) {
        this.subcontResName = subcontResName;
    }

    public JobsTitles getRole() {
        return role;
    }

    public void setRole(JobsTitles role) {
        this.role = role;
    }

    public Projects getProjectCode() {
        return projectCode;
    }

    public void setProjectCode(Projects projectCode) {
        this.projectCode = projectCode;
    }

    public Employees getEmployee() {
        return employee;
    }

    public void setEmployee(Employees employee) {
        this.employee = employee;
    }

    public Currencies getCurrency() {
        return currency;
    }

    public void setCurrency(Currencies currency) {
        this.currency = currency;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (scId != null ? scId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SourceCode)) {
            return false;
        }
        SourceCode other = (SourceCode) object;
        if ((this.scId == null && other.scId != null) || (this.scId != null && !this.scId.equals(other.scId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojos.SourceCode[ scId=" + scId + " ]";
    }
    
}
